-
Notifications
You must be signed in to change notification settings - Fork 183
Implements EPUB transformer (#1350) #1372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
closes #1350 |
|
can you rebase on main? then you can probably get rid of the |
|
additionally, if you make it pass CI then I will take a deeper look |
Unfortunately that doesn’t do it. This is needed, because docusaurus seems to recompile the reference |
|
oh that's interesting. |
|
actually, upon further investigation, we have |
|
please remove the changes to package.json + package-lock.json. |
I was unsure and couldn’t figure out why I didn’t do that in the first place, when you first asked, but now figured it out. I think the situation is this:
(See outputs of My guess is that having a link to another file from mdx to mdx, is somehow illegal from docusaurus’ point of view, so they update that. Even though I’m a little annoyed I have to fix another mistake, I think I should include logic for this, because docusaurus supports it. |
by this, do you mean to say "the only mdx file that is referenced from another .mdx file"? |
You’re right. I didn’t express myself clearly. There was a word missing there. I meant to say 5-pull-double-finesse.mdx is the only file, which starts with a digit, that’s referenced from another .mdx file. |
|
oh I see. |
I agree. I’ll do that later, though. I started using the epub and found another small bug, that I’ll have to fix. I’m out of time for today, though. Gotta do other stuff. I also fixed the CI as far as I could, without getting into fixing approach to launching my transformer (I expect the build dir to exist, but it doesn’t seem to). Problem for later me. |
|
@Zamiell Implemented the fix we talked about and two more. Also got the pipeline to run through. Aside from your review of the code the big thing that’s left, is to decide where to link to the epub file. It’s stored under |
|
I think you can put a link on this page: https://hanabi.github.io/about |
|
Did you get a chance to take a closer look @Zamiell? |
|
i'll take a look now |
|
I rebased your branch on main and then made several commits, you can review them above if you'd like. Now: Is there a reason that the script has to be in Python? We don't have any other Python files in this repo, so we don't have the tooling set up to ensure that Python files are linted, to ensure that Python files are formatted, and so on. Docusaurus uses TypeScript, and we already wrote the YAML --> SVG code in TypeScript. So, I think TypeScript might also be the correct choice for this script. If you did that, then we also clean up the Assuming that there isn't a good reason for it to be in Python, can you use an LLM to convert it from Python to TypeScript? And then ensure that the converted version still works? |
|
Also, I tried to run the Python script and it didn't work: This might be because:
For now, I'll just report it here, but ultimately we should get this fixed, because before I merge this PR, I would want to get the script working correctly on my local computer so that I can open the epub and check it out. |
|
I removed the newline from the mimetype file, because some e-readers might not handle that well. The EPUB specification requires that this file only contain the string and no newlines (20 bytes). If there is a newline epubcheck fails. |
I hope this won't be a long back and forth, but I added some fixes. The error you got, most likely comes from python choosing the system file encoding (when no encoding is specified), which is not UTF-8 on Windows, so when a UTF-8 character is read, it chokes. I should have and now have updated all file operations to use UTF-8 explicitly, so that would fix this issue. Let's hope there are no other platform specific issues. The other important thing you need to have is a valid build in the build folder, since the SVGs for the examples are extracted from there. |
Not really, other than me knowing it would be possible. I will try to get that working in TS, but it'll probably take me a while, because I assume that none of the LLMs I have access to, would be powerful enough to do this at all or without errors. |
|
And thank you for taking the time to look at it in depth! |
|
gemini 3 is free and should be able to accomplish this task |
This PR implements a python script that runs in the CI pipeline, which converts the entire hanabi.github.io content (except for one page) into an epub e-book.
This is still a draft, because I haven’t quite figured out how to get the pipeline to run the script automatically, but the script itself is complete. If someone wants to adjust the pipeline config to complete that, please be my guest.
To run the script locally just checkout the branch and run
./scripts/epub.sh. Download the my latest compilation of the epub here (too large for github attachments, expires 2025-01-01).Authors Note: I’m so glad I’m finally done. This project probably took me upwards of 60 hours to complete. Even thought it was 95 % of great fun, the other 5 % were agonising debugging hell.